package cn.itcast.feign.fallback;

import cn.itcast.feign.clients.UserClient;
import cn.itcast.feign.pojo.User;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author Broxigar
 * @Date 2022/2/17 20:27
 * @Version 1.0
 */

@Slf4j
public class UserClientFallbackFactory implements FallbackFactory<UserClient> {

    @Override
    public UserClient create(Throwable throwable) {

        return new UserClient() {
            @Override
            public User findById(Long id) {

                log.error("查询用户异常", throwable);

                return null;
            }
        };
    }


}
